﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TeacherLeftHand.Util
{
    public static class StringExtension
    {
        public static string ConvertToRtf(this string value)
        {
            RichTextBox richTextBox = new RichTextBox {Text = value};
            int offset = richTextBox.Rtf.IndexOf(@"\f0\fs17") + 8; // offset = 118;
            int len = richTextBox.Rtf.LastIndexOf(@"\par") - offset;
            string result = richTextBox.Rtf.Substring(offset, len).Trim();
            return result;
        }

    }
}
